home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
os2
/
adaptor.zip
/
ADAPT.ZIP
/
adaptor
/
examples
/
dalib
/
move
/
move4.f
< prev
next >
Wrap
Text File
|
1993-03-23
|
3KB
|
119 lines
program move4
real a(6,6,6,6), ha(6,6,6,6), ha1(6,6,6,6)
cmf$ layout ha(:host), ha1(:host)
real b(10,10), hb(10,10), hb1(10,10)
cmf$ layout hb(:host), hb1(:host)
integer i, j, k, errors, switch
call cmf_random (a)
call cmf_random (b)
ha = a
hb = b
print *, 'Initialisation is ready'
print *, 'Chosse switch (1-6) : '
read *, switch
c now operate on distributed arrays, make the same with host
if (switch .eq. 1) then
print * , 'one -> one'
b(3:6,4) = a(1,2:5,5,3)
hb(3:6,4) = ha(1,2:5,5,3)
end if
c
if (switch .eq. 2) then
print * , 'many -> many'
b(2:5,2:5) = a(3:6,4,1,3:6)
hb(2:5,2:5) = ha(3:6,4,1,3:6)
end if
if (switch .eq. 3) then
print *, 'many -> one'
a(1:4,3,2,5) = b(4,6:9)
ha(1:4,3,2,5) = hb(4,6:9)
a(3,1:6,2,6) = b(4,5:10)
ha(3,1:6,2,6) = hb(4,5:10)
a(3,6,2:5,1) = b(4,1:4)
ha(3,6,2:5,1) = hb(4,1:4)
end if
if (switch .eq. 31) then
print *, 'many -> one'
a(1:4,3,2,5) = b(4,6:9)
ha(1:4,3,2,5) = hb(4,6:9)
end if
if (switch .eq. 32) then
print *, 'many -> one'
a(3,1:6,2,6) = b(4,5:10)
ha(3,1:6,2,6) = hb(4,5:10)
end if
if (switch .eq. 33) then
print *, 'many -> one'
a(3,6,2:5,1) = b(4,1:4)
ha(3,6,2:5,1) = hb(4,1:4)
end if
if (switch .eq. 4) then
print *, 'one -> many'
b(5:9,2:6) = a(2:6,1:5,4,4)
hb(5:9,2:6) = ha(2:6,1:5,4,4)
end if
if (switch .eq. 5) then
print *, 'shifting in dim1'
a(2:5,2:5,2:5,1:4) = a(2:5,2:5,2:5,3:6)
ha(2:5,2:5,2:5,1:4) = ha(2:5,2:5,2:5,3:6)
end if
if (switch .eq. 6) then
print *, 'shifting in dim1 + dim2'
a(2:5,2:5,1:4,1:4) = a(2:5,2:5,3:6,2:5)
ha(2:5,2:5,1:4,1:4) = ha(2:5,2:5,3:6,2:5)
end if
c now compare distributed arrays with host arrays
print *,'Operations are finished'
ha1 = a
hb1 = b
c
c ha1 == ha ?, hb1 == b ?
print *,'Now checking'
errors = 0
do j = 1, 10
do i = 1, 10
if (hb(i,j) .ne. hb1(i,j)) then
print *, 'HB for i, j = ', i, j
errors = errors + 1
end if
end do
end do
do l = 1, 6
do k = 1, 6
do j = 1, 6
do i = 1, 6
if (ha(i,j,k,l) .ne. ha1(i,j,k,l)) then
print *, 'HA for i, j, k, l = ', i, j, k, l
errors = errors + 1
end if
end do
end do
end do
end do
print *, 'Errors = ', errors
end